package io.serializable;

import framework.AbstractTest;
import utils.Log;

import java.io.*;

/**
 * Created by shane on 2018/6/2.
 */
public class OrderedData extends AbstractTest implements Serializable {
    private static final long serialVersionUID = -6016900809651399428L;

    String y;
    int x;
    boolean z;
    NonSerializeData data;


    public OrderedData() {
        y = "xxx";
        x = 5;
        data = new NonSerializeData();
        z = true;
    }

    @Override
    public String toString() {
        return "x:" + x + ", y:" + y + ", noy:" + data.y + ", z:" + String.valueOf(z);
    }

    @Override
    public void test(String[] args) {
        super.test(args);

        String tempFile = getDefTempFile(args);

        try {
            OrderedData data = new OrderedData();
            data.y = "lxxgreat";
            Log.vn(String.valueOf(y.equals(1)));
            data.data.y = "1234";

//            ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(tempFile));
//            out.writeObject(data);
//            out.close();

            ObjectInputStream in = new ObjectInputStream(new FileInputStream(tempFile));
            OrderedData inData = (OrderedData)in.readObject();
            in.close();
            Log.vn(inData.toString());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
